package com.example.demo.controller;

import com.example.demo.service.BillService;
import com.example.demo.service.CustomerService;
import com.example.demo.service.RoomService;
import com.example.demo.service.RoomTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
@Component
public class WelcomeController {
    @Autowired
    private CustomerService customerService;
    @Autowired
    private RoomService roomService;
    @Autowired
    private RoomTypeService roomTypeService;
    @Autowired
    private BillService billService;
    @Transactional
    @RequestMapping("/Admin/getlivingCount")
    @ResponseBody
    public String getlivingCount(){
        int count4 = customerService.getlivingCount();
        return String.valueOf(count4);
    }
    @Transactional
    @RequestMapping("/Admin/getCustCount")
    @ResponseBody
    public String getCustCount(){
        int count = customerService.getCustCount();
        return String.valueOf(count);
    }
    @Transactional
    @RequestMapping("/admin/roomCount")
    @ResponseBody
    public String getRoomCount(){
        int count2 = roomService.getRoomCount();
        return String.valueOf(count2);
    }
    @Transactional
    @GetMapping("/admin/roomcount")
    @ResponseBody
    public String getTypeCount(){
        int count3 = roomTypeService.getTypeCount();
        return String.valueOf(count3);
    }

    @Transactional
    @RequestMapping("/Admin-billcount")
    @ResponseBody
    public String countallBil(){
        int count1 = billService.countallBill();
        return String.valueOf(count1);
    }
}
